<form autocomplete="off" id="authentificationform" method="post"
	name="searchform" action="index.php?module=forgetpassword">
	<div class="account-container stacked">
		<div class="content clearfix">
			<h1>Vous avez oubli&eacute; votre mot de passe ?</h1>
			<div class="login-fields">
				<p>Saisissez votre identifiant (example@example.com)</p>
				<div class="field">
					<label for="login">Identifiant :</label> <input type="text"
						id="login" name="login" placeholder="Identifiant"> <br/><br/><label
						for="captcha">Captcha :</label> <img src="modules/captcha.php" />
					<input type="text" name="captcha" placeholder="captcha"
						style="width: 80px" /><br/>
						<input type="hidden" name="captcha2" value="<?php echo $_SESSION['captcha'];?>" /><br/>
					<button class="button btn btn-warning btn-large" id="button"
						value="Login" type="submit">R&eacute;initialiser le mot de passe</button>
					<br />
										
					<?php
					
					//echo 'captcha SESSION : ' . $captcha . '<br>';
					//echo 'captcha POST : ' . $_POST ['captcha'];
					
					if (isset ( $_POST ['captcha2'] )) {
						if ($_POST ['captcha'] == $_POST ['captcha2']) {
							if (isset ( $_POST ['login'] )) {
								$connect = connexion ( SQLHOST, SQLUSER, SQLPASS, SQLDB );
								$req = 'SELECT * FROM user WHERE email = "' . $_POST ['login'] . '"';
								$result = extraire ( $connect, $req );
								$row = mysql_fetch_array ( $result );
								if (isset ( $row [1] )) {
									$connect = connexion ( SQLHOST, SQLUSER, SQLPASS, SQLDB );
									$req = 'UPDATE user SET pass = "' . md5 ( "5gGeR72kW25" ) . '" WHERE email = "' . $_POST ['login'] . '"';
									$result = extraire ( $connect, $req );
									echo '<p style="color:green">Votre mot de passe a &eacute;t&eacute; r&eacute;initialis&eacute;.<br/>Votre nouveau mot de passe est : <b>5gGeR72kW25</b></p>';
								} else {
									echo '<p style="color:red">Ce login n\'existe pas !</p>';
								}
								mysql_close ( $connect );
							}
						} else {
							echo '<p style="color:red">Oups, le captcha est incorect !</p>';
						}
					}
					?>
							
				</div>
			</div>
		</div>
	</div>
</form>
